Color Matching on PostScript Devices
If you are writing a printer driver for a PostScript device, you need to perform a few additional tasks to optimize color matching:
The following sections discuss these three tasks.
- Choose the color space your driver uses. The color space tells QuickDraw GX what kind of PostScript operators to use when specifying colors for your printing device.
- If your PostScript device supports Level 2 of the PostScript language, offload the color-matching work to the printing device rather than having the Macintosh perform the matching work (which can be time consuming).
- Generate portable PostScript code to guarantee that the best output results are generated for any PostScript device with which your driver is used.
Choosing a Color Space for a PostScript Printing Device
You must choose one of three color-space values for a PostScript device, each of which defines which PostScript operators QuickDraw GX uses to send color information.
Table 3-8 shows the color-space values that you can use.
Table 3-8 PostScript color-space choices Color space PostScript operators used by QuickDraw GX gxRGBSpace setrgbcolor
andcolorimage
gxCMYKSpace setcmykcolor
andcolorimage
gxGraySpace setgray
andimage
The color-space values are described the chapter "Colors and Color-Related Objects" in Inside Macintosh: QuickDraw GX Objects. If you specify the wrong color space, then PostScript errors are generated. For example, if you specify the
gxCMYKSpace
color-space and your driver is connected to a printer that does not support thesetcmykcolor
operator, an error occurs. You can get around this situation by generating portable PostScript code, as described in the section "Generating Portable PostScript" on page 3-53.Using PostScript's Color Matching
If your printer driver is communicating with a PostScript device that supports Level 2
of the PostScript language, you can offload the color matching to the device rather than performing this time-consuming work in your driver. To do this, you need to specify two values in the PostScript preferences ('pdip'
) resource for your driver: the language-level field must be set to 2, and you must includegxUseLevel2ColorOption
in the render options field of the resource.When you specify these values in your PostScript preferences resource, QuickDraw GX generates PostScript code that is optimized for the PostScript Level 2 interpreter. This means that QuickDraw GX allows the PostScript interpreter to perform the color matching rather than calling ColorSync to do so. QuickDraw GX converts the color space and color profile of the objects being printed into a Level 2 color-space dictionary by using the
setcolorspace
operator. The colors for the objects are set with thesetcolor
operator, and bitmaps are drawn with the Level 2 dictionary form of theimage
operator. If a bitmap's color space is defined as 5 or 8 bits per component, theimage
operator is used at 8 bits per component. If a bitmap's color space is defined as 10 bits per component, theimage
operator is used at 12 bits per component.Since not all QuickDraw GX color spaces cannot be translated to PostScript Level 2, QuickDraw GX might need to convert the color space of the object. For example, if the object specifies
gxCIESpace
, which cannot be emulated with thesetcolorspace
operator, QuickDraw GX converts the colors intogxXYZSpace
, which can be emulated.If you set the language level to 2 but do not specify
gxUseLevel2ColorOption
as a rendering option in your PostSript preferences resource, QuickDraw GX generates code that is optimized for the Level 2 interpreter, but calls ColorSync to perform color matching.Generating Portable PostScript
Since your PostScript driver can be used with a variety of printing devices, you need to be careful about which color space you specify. If you specify a color space that is not supported by the printing device, PostScript errors are generated. The best way to avoid this problem is to tell QuickDraw GX to generate portable PostScript code, which can be executed on any PostScript printing device and gives the best results that the printer
can produce.The only color space that is guaranteed to work on all PostScript devices is
gxGraySpace
. However, this color space generates grayscale even on a printer that supports color. To get QuickDraw GX to produce PostScript data that contains all of the color information but still renders on a monochrome device in grayscale, you need to specify two values in the PostScript preferences ('pdip'
) resource: includegxPortablePostScriptOption
in the render options field, and specifygxRGBSpace
as the device's color-space value.When you specify these values, QuickDraw GX defines PostScript procedures that emulate any color operators that are not available on the output device. QuickDraw GX also generates PostScript code to set up a Level 2 color space that is based on the color profile defined for your driver. If your driver is connected to a device that has Level 2 specified in its profile, color-matched output is generated.
Main | Page One | What's New | Apple Computer, Inc. | Find It | Contact Us | Help